package com.qiusuo0226.core.pojo.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import com.gitee.sunchenbin.mybatis.actable.annotation.Table;
import com.gitee.sunchenbin.mybatis.actable.annotation.TableCharset;
import com.gitee.sunchenbin.mybatis.actable.annotation.TableEngine;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlCharsetConstant;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlEngineConstant;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;
import com.qiusuo0226.core.constant.Tables;
import com.qiusuo0226.mysql.pojo.CommonEntity;
import lombok.*;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 行政区划
 * @author qiusuo
 * @date 2022-04-04
 */
@ToString
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = Tables.CORE_ADMINISTRATIVE_DIVISION)
@Table(name = Tables.CORE_ADMINISTRATIVE_DIVISION, comment = "行政区划表")
@TableCharset(MySqlCharsetConstant.UTF8MB4)
@TableEngine(MySqlEngineConstant.InnoDB)
public class AdministrativeDivisionDO extends CommonEntity implements Serializable {
    private static final long serialVersionUID = -2913925090488398037L;


    @TableField(value = "name")
    @Column(name = "name", type = MySqlTypeConstant.VARCHAR, length = 100, comment = "行政区划名称", defaultValue = "", isNull=false)
    private String name;


    @TableField(value = "short_name")
    @Column(name = "short_name", type = MySqlTypeConstant.VARCHAR, length = 50, comment = "行政区划简称", defaultValue = "", isNull=false)
    private String shortName;


    @TableField(value = "code")
    @Column(name = "code", type = MySqlTypeConstant.VARCHAR, length = 255, comment = "行政区划编码", defaultValue = "", isNull=false)
    private String code;


    @TableField(value = "parent_id")
    @Column(name = "parent_id", type = MySqlTypeConstant.BIGINT, comment = "行政区划父级唯一标识", defaultValue = "0", isNull=false)
    private Long parentId;

    @TableField(value = "level")
    @Column(name = "level", type = MySqlTypeConstant.INT, length = 2, comment = "行政区划级别(1省/直辖市,2地级市,3区县,4镇/街道)", defaultValue = "1", isNull=false)
    private Integer level;

    @TableField(value = "sort")
    @Column(name = "sort", type = MySqlTypeConstant.INT, length = 11, comment = "排序", defaultValue = "1", isNull=false)
    private Integer sort;

    @TableField(value = "longitude")
    @Column(name = "longitude", type = MySqlTypeConstant.DECIMAL, length = 10, decimalLength = 3,comment = "经度", defaultValue = "1", isNull=false)
    private BigDecimal longitude;

    @TableField(value = "latitude")
    @Column(name = "latitude", type = MySqlTypeConstant.DECIMAL, length = 10, decimalLength = 3, comment = "纬度", defaultValue = "1", isNull=false)
    private BigDecimal latitude;

    @TableField(value = "longitude_unit")
    @Column(name = "longitude_unit", type = MySqlTypeConstant.VARCHAR, length = 10, comment = "经度单位，东经E、西经W", defaultValue = "E", isNull=false)
    private String longitudeUnit;

    @TableField(value = "latitude_unit")
    @Column(name = "latitude_unit", type = MySqlTypeConstant.VARCHAR, length = 10, comment = "纬度单位，南纬S、北纬N", defaultValue = "N", isNull=false)
    private String latitudeUnit;
}
